require.config({
    baseUrl: "./js",
    paths: {
        "jquery": "jquery-1.12.2.min",
        "swiper": "swiper.min",
        "validator": "validator.min",
        "datepick": "datepick"
    }
});

require(['jquery', 'fn', 'datepick'], function ($, fn, datepick) {
    $(document).ready(function () {
        // togglebar
        $("#popPraise").on("click", function () {
            fn.toggleBar("praise", "newest");
            fn.addActive("popPraise", "popNewest");
        });
        $("#popNewest").on("click", function () {
            fn.toggleBar("newest", "praise");
            fn.addActive("popNewest", "popPraise");
        });

        $("#popAuditsucc").on("click", function () {
            fn.toggleBar("audit-succ", "audit-ing", "audit-fail");
            fn.addActive("popAuditsucc", "popAuditing", "popAuditfail");
        });
        $("#popAuditing").on("click", function () {
            fn.toggleBar("audit-ing", "audit-succ", "audit-fail");  
            fn.addActive("popAuditing", "popAuditsucc", "popAuditfail"); 
        });
        $("#popAuditfail").on("click", function () {
            fn.toggleBar("audit-fail", "audit-succ", "audit-ing");
            fn.addActive("popAuditfail", "popAuditing", "popAuditsucc");
        });

        $("#popWisdombox").on("click", function () {
            fn.toggleBar("wisdom-box", "optional-box");
            fn.addActive("popNewest", "popPraise");
        });
        $("#popOptionalbox").on("click", function () {
            fn.toggleBar("optional-box", "wisdom-box");
            fn.addActive("popNewest", "popPraise");
        });

        $("#popWisdombox").on("click", function () {
            fn.toggleBar("wisdom-box", "optional-box", "chooseme-box");
            fn.addActive("popWisdombox", "popOptionalbox", "popChoosemebox");
        });
        $("#popOptionalbox").on("click", function () {
            fn.toggleBar("optional-box", "wisdom-box", "chooseme-box");
            fn.addActive("popOptionalbox", "popWisdombox", "popChoosemebox");
        });
        $("#popChoosemebox").on("click", function () {
            fn.toggleBar("chooseme-box", "wisdom-box", "optional-box");
            fn.addActive("popChoosemebox", "popWisdombox", "popOptionalbox");
        });

        $("#popNotsellbox").on("click", function () {
            fn.toggleBar("notsell-box", "notselled-box")
            fn.addActive("popNotsellbox", "popNotselledbox")
        });
        $("#popNotselledbox").on("click", function () {
            fn.toggleBar("notselled-box", "notsell-box");
            fn.addActive("popNotselledbox", "popNotsellbox")
        });

        //
        $("#skipStep2").on("click", function () {
            fn.toggleBar("audit-step2", "audit-step1", "audit-step3");
        })
        $("#skipStep3").on("click", function () {
            fn.toggleBar("audit-step3", "audit-step1", "audit-step2");
        })

        // mouseenter
        $("#area-gz").on("mouseenter", function () {
            $(".menubox-gz").show();
        });
        $("#area-gz").on("mouseleave", function () {
            $(".menubox-gz").hide();
        });

        // 下拉菜单，待删
        $("#dropdownSpon").on("mouseenter", function () {
            $(".dropdown-nav-spon").show();
        });
        $("#dropdownSpon").on("mouseleave", function () {
            $(".dropdown-nav-spon").hide();
        });
        $("#dropdownEnte").on("mouseenter", function () {
            $(".dropdown-nav-ente").show();
        });
        $("#dropdownEnte").on("mouseleave", function () {
            $(".dropdown-nav-ente").hide();
        });

        fn.showDropdownMenu("showDropdownMenu1", "dropdownMenu1");
        fn.showDropdownMenu("showDropdownMenu2", "dropdownMenu2");
        fn.showDropdownMenu("showDropdownMenu3", "dropdownMenu3");

        // toggleBox
        $("#showBox1").on("click", function () {
            fn.toggleBox("box1", "box2");
            fn.addActive("showBox1", "showBox2");
        });
        $("#showBox2").on("click", function () {
            fn.toggleBox("box2", "box1");
            fn.addActive("showBox2", "showBox1");
        });

        fn.swiper();
        fn.formValidate();
        fn.getAuditcode();
        datepick.datepick();
    });
});
